/**
 * 小程序配置文件
 */
import {NativeModules,} from 'react-native';


// let config = {
//     apiUrl:'https://api.houhou-mpmc.com/router?',
//     uploadUrl:'https://my.houhou-mpmc.com/api/fileUpload.do',
//     app_key:'0617CA8376F9901F28FF46B69BF9CF55',
//     secret:'28570C9D069ED51226DD9F028BD5E6EE'
// };

let config = {
    apiUrl:'https://api.xiniunet.com/router?',
    uploadUrl:'https://my.xiniunet.com/api/fileUpload.do',
    app_key:'48C6AEB8E12E2D3D249B4D7771594AD6',
    secret:'684CE9EF4B118766F3746997C9A256D2'
};

function getMode() {
    return new Promise((resolve => {
        resolve('xntalkdev');
        NativeModules.system.getMode().then(result => {
            resolve(result);
        })
    }))

};

getMode().then(
  (result) => {
      if(result.toLowerCase() === "xntalkdev") {
          // 开发环境
        config.apiUrl='https://api-plat.xiniunet.com/router?';
        config.app_key = 'FEDA506D38D8E930626E850139E74E0C';
        config.secret = '9019951CC31D86A31D2E911D4BE51142';
        config.uploadUrl = 'https://my-plat.xiniunet.com/api/fileUpload.do';
      } else if(result.toLowerCase() === "xntalktest") {
        config.apiUrl='https://api-test.xiniunet.com/router?';
        config.app_key = 'FEDA506D38D8E930626E850139E74E0C';
        config.secret = '9019951CC31D86A31D2E911D4BE51142';
        config.uploadUrl = 'https://my-test.xiniunet.com/api/fileUpload.do';
      }
  }
).catch((error) => {
  console.log(error)
});
module.exports = config;
